package 面向对象;

import java.util.Scanner;

public class test4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int money;
        while(true) {
            System.out.println("请输入金额:");
            money = sc.nextInt();
            if (money >= 0 && money <= 9999999) {
                break;
            } else{
                    System.out.println("金额无效");
                }
            }
        String moneyStr = "";
        while(true) {
            int ge = money % 10;
            String qwe=bigmoney(ge);
           moneyStr = qwe + moneyStr;
            money = money / 10;
            if(money == 0){
                break;
            }
        }
        int count = 7 - moneyStr.length();
        for(int i = 0 ; i< count ; i++){
            moneyStr ="零"+moneyStr;
        }
        System.out.println(moneyStr);

        String[] arr ={"佰","拾","万","仟","佰","拾","元"};
        for(int i = 0 ; i<arr.length ;i++){
            char c = moneyStr.charAt(i);
            System.out.print(c);
            System.out.print(arr[i]);
        }


        }
    public static String bigmoney(int number){
        String [] arr ={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};
        return arr[number];
    }
}
